package com.cheyun.netsalev3.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter

/**
 * @author Michael
 * @date  2018/10/29 - 17:30.
 */
class HomePageAdapter(
        fm: FragmentManager,
        fragmentlist: MutableList<Fragment>
) : FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {
    val fragmentlist = fragmentlist
    var titles: ArrayList<String>? = null
    var badges: ArrayList<Int>? = null

    override fun getCount(): Int = fragmentlist.size
    override fun getItem(position: Int): Fragment {
        return fragmentlist[position]
    }


    override fun getPageTitle(position: Int): CharSequence? {
        return if (titles == null) super.getPageTitle(position) else titles!![position]
    }

}